﻿using System;
using System.Xml;
using System.Xml.Linq;

namespace InfiniTec.Xml.Linq
{
	public static class XDocumentExtension
	{
		public static XmlDocument ToXmlDocument(this XDocument input)
		{
			if (input == null) throw new ArgumentNullException("input");

			var content = input.ToString(SaveOptions.DisableFormatting);
			var result = new XmlDocument();
			result.LoadXml(content);
			return result;
		}
	}
}
